package com.lframework.xingyun.basedata.mappers;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.lframework.starter.web.core.mapper.BaseMapper;
import com.lframework.xingyun.basedata.entity.ShopProduct;
import com.lframework.xingyun.basedata.vo.shop.QueryShopProductVo;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * <p>
 * 门店商品关系表 Mapper 接口
 * </p>
 *
 */
@Mapper
public interface ShopProductMapper extends BaseMapper<ShopProduct> {

    /**
     * 查询分页
     * @param vo
     * @return
     */
    default IPage<ShopProduct> queryPage(QueryShopProductVo vo) {
        return defaultJoinWrapper()
                .eq("shop_id", vo.getShopId())
                .page(PageDTO.of(vo.getPageIndex(), vo.getPageSize()));
    }

    /**
     * 查询列表
     * @param vo
     * @return
     */
    default List<ShopProduct> queryList(QueryShopProductVo vo) {
        return defaultJoinWrapper()
                .eq("shop_id", vo.getShopId())
                .list();
    }
}

